<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>设置密码</title>
		<link rel="stylesheet" type="text/css" href="/front/css/headfoot.css"/>
		<link rel="stylesheet" type="text/css" href="/front/css/login.css"/>
		<link rel="stylesheet" type="text/css" href="/front/css/resetpwd.css"/>
	</head>
	<body>
		<!--顶部开始-->
		<header>
			<div id="login-header">
				<div class="login-header-middle">
					<div class="login-header-left">
						<a href={php} echo url('/web/index','','','www') {/php} title="首页">
							<i></i>
							<span class="login-shsy">双辉旅程网</span>
						</a>
						<span class="wel-login">设置密码</span>
					</div>
				</div>
			</div>
		</header>
		<!--顶部结束-->
		<!--重置登录密码开始-->
		<div id="resetpwd-box">
			<div class="resetpwd-bg-img">
				<form action="javascript:;" method="get" id="resetpwdform">
					<div class="resetpwd-form">
						<div class="resetpwd-account">
							<p class="account-p">设置密码</p>
						</div>
						<div class="form-group-input">
							<div class="input-title">新登录密码<span id="passworderror"></span></div>
							<input type="password" name="password"  placeholder="请输入新的登录密码"/>
						</div>
						<div class="form-group-input">
							<div class="input-title">请确定密码<span id="repasswprderror""></span></div>
							<input type="password" name="repassword"  placeholder="请输入确认密码"/>
						</div>
						<div class="form-group-input">
							<button id="aa" >提<i style="padding: 0px 5px;"></i>交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
		<!--重置登录密码结束-->
		<script type="text/javascript" src="/jquery.js"></script>
		<script type="text/javascript">
    	$(function(){
    		//新密码
    		$("input[name='password']").blur(function(){
    			var password = $('input[name="password"]').val();
    			//不能为空
    			if(!$.trim(password)) {
					$("input[name='password']").css({border: "1px solid red"});
					$("#passworderror").html("请输入密码");
					return false;
    			}else{
    				$.get('/userforgotpwd/checkpassword?password='+$("input[name='password']").val(),function(data) {
						$("input[name='password']").css({border: "1px solid green"});
						$("#passworderror").html("");
						if (data===0) {
							$("input[name='password']").css({border: "1px solid red"});
							$("#passworderror").html("密码应为6~16位的字母和数字组合");
						}
					});
    			}
    		})
    		//确定密码
    		$('input[name="repassword"]').blur(function(){
    			var repassword = $('input[name="repassword"]').val();
    			var password = $('input[name="password"]').val();
    			//不能为空
    			if(!$.trim(repassword)) {
					$("input[name='repassword']").css({border: "1px solid red"});
					$("#repasswprderror").html("请重新输入密码");
					return false;
    			}else {
    				if (password===repassword) {
    					$("input[name='repassword']").css({border: "1px solid green"});
						$("#repasswprderror").html("");
    				}else{
    					$("input[name='repassword']").css({border: "1px solid red"});
						$("#repasswprderror").html("密码不一致");
    				}
    			}
    		})
    	})
    </script>
    <script type="text/javascript">
	      $(document).ready(function(){
	        //提交表单
	        $("#aa").click(function(){
	        $("#resetpwdform").attr('action','/userforgotpwd/resetpwdform');
	        $("#resetpwdform").submit();
	          });

	        });  
	</script>
		<!--公共底部开始-->
		{include file='./base/footer'}
		<!--公共底部结束-->
	</body>
</html>
